<template>
  <div class="my_discovery">
    <!-- 轮播图区域 -->
    <van-swipe :autoplay="3000" lazy-render>
      <van-swipe-item v-for="image in images" :key="image">
        <img :src="image" width="100%" height="200px" />
      </van-swipe-item>
    </van-swipe>

    <!-- 宫格导航区域 -->
    <van-grid :border="false" :column-num="4">
      <van-grid-item v-for="item in gridData" :key="item.id">
        <van-image :src="item.imgUrl" height="40px" />
        <div class="grid_text">{{ item.text }}</div>
      </van-grid-item>
    </van-grid>

    <!-- 发现好歌曲 -->
    <div class="music_list">
      <div class="text">发现好歌曲</div>
      <van-button plain round type="default" size="small">
        <span>查看更多</span>
      </van-button>
    </div>
    <!-- 歌单列表 -->
    <van-row :gutter="[20, 20]">
      <van-col span="12" v-for="item in musicList" :key="item.id" @click="toMusicList(item.id)">
        <img :src="item.musicImg" alt="" width="100%" height="180px">
        <div>{{ item.auth }}</div>
      </van-col>
    </van-row>
  </div>
</template>
<script setup>
import { ref } from 'vue'
// 宫格数据
const gridData = ref([
  { id: 1, imgUrl: 'https://gd-hbimg.huaban.com/121eab781718a753da1edd4f8c770aa47d5cb1a9265cf-a0Ezx7_fw658', text: "每日推荐" },
  { id: 2, imgUrl: 'https://gd-hbimg.huaban.com/575c4a709f334079579668fb7642915002a8925f1d355-DtrN7T_fw658', text: "私人FM" },
  { id: 3, imgUrl: 'https://pic.616pic.com/ys_img/01/15/15/eeXPVNYAva.jpg', text: "歌单" },
  { id: 4, imgUrl: 'https://img.51miz.com/Element/00/77/57/30/f139065b_E775730_670e5d6d.png', text: "排行榜" },
])

//歌单数据
const musicList = ref([
  {id:1,musicImg:'\第六感.jpg',auth:'第六感'},
  {id:2,musicImg:'\玫瑰少年.png',auth:'玫瑰少年'},
  {id:3,musicImg:'\DayDream.png',auth:'DayDream'},
  {id:4,musicImg:'\To the infinity Castle.jpg',auth:'To the infinity Castle'}
])

// 轮播图静态数据
const images = [
  'https://img.zcool.cn/community/01e54a5ff6c79b11013fdcc75500c9.jpg@1280w_1l_2o_100sh.jpg',
  'https://img.zcool.cn/community/01ef045cf7c8b5a801205e4b6264a9.jpg@1280w_1l_2o_100sh.jpg',
  'https://img.zcool.cn/community/01af9f5ca6efada8012141680f030c.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100'
];

// 跳转歌单详情页面
const toMusicList = (id)=>{
  console.log('跳转歌单详情',id);
}
</script>
<style scoped>
.my_discovery {
  margin-top: 10px;
  padding: 0 10px;
  height: calc(100vh - 110px);
  overflow-y: scroll;
}

.grid_text {
  font-size: 15px;
}

.music_list {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.music_list .text {
  color: #000;
  font-size: 18px;
  font-weight: 600;
}

.music_list span {
  color: #000;
}</style>